﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.HtmlControls;


public class UserControlBase : System.Web.UI.UserControl
{
    protected int? UserID
    {
        get
        {
            return new NonSecuredBaseView().UserID;
        }
    }
    protected int? CompanyID
    {
        get
        {
            return new NonSecuredBaseView().CompanyID;
        }
    }
    protected string UserName
    {
        get
        {
            return new NonSecuredBaseView().UserName;
        }
    }
    protected string ImageName
    {
        get
        {
            return new NonSecuredBaseView().ImageName;
        }
    }



    protected string getUserHREF(object sURL)
    {
        com.Bliss.Post post = (com.Bliss.Post)sURL;
        string Id = post.PostedBy.ID.ToString();
        return ResolveUrl("~/UserDetails.aspx?Id=" + Id);
    }
    protected string AutoConvertToHTML(object message)
    {
        com.Bliss.Post post = (com.Bliss.Post)message;
        return Utility.AutoConvertToHTML(post.Message);
    }
    protected string getSRC(object imgSRC)
    {
        com.Bliss.Post post = (com.Bliss.Post)imgSRC;
        string ImageName = post.PostedBy.ImageName;
        if (ImageName == "NoImage")
        {
            return ResolveUrl(@"~/UserImage/image_missing.jpg");
        }
        else
        {
            return ResolveUrl("~/UserImage/" + ImageName);
        }
    }
    protected string getUserHREFSecondLavel(object sURL)
    {
        com.Bliss.Post post = (com.Bliss.Post)sURL;
        string Id = post.PostedBy.ID.ToString();
        return ResolveUrl("~/UserDetails.aspx?Id=" + Id);
    }
    protected string getSRCSecondLavel(object imgSRC)
    {
        com.Bliss.Post post = (com.Bliss.Post)imgSRC;
        string ImageName = post.PostedBy.ImageName;
        if (ImageName == "NoImage")
        {
            return ResolveUrl(@"~/UserImage/image_missing.jpg");
        }
        else
        {
            return ResolveUrl("~/UserImage/" + ImageName);
        }
    }

    protected string ErrorMessage
    {
        set
        {
            new NonSecuredBaseView(this).ErrorMessage = value;
        }
    }
    protected string ExceptionMessage
    {
        set
        {
            new NonSecuredBaseView(this).ExceptionMessage = value;
        }
    }
    protected string SuccessMessage
    {
        set
        {
            new NonSecuredBaseView(this).SuccessMessage = value;
        }
    }
    protected void ClearMessage()
    {
        new NonSecuredBaseView(this).ClearMessage();
    }
}